| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 1 | # See www/CMake.html for instructions on how to build libcxx with CMake. | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 2 | #=============================================================================== | 
 | 3 | # Setup Project | 
 | 4 | #=============================================================================== | 
| Chris Bieneman | cad86ff | 2016-05-31 20:21:52 | [diff] [blame] | 5 | cmake_minimum_required(VERSION 3.4.3) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 6 |  | 
| Eric Fiselier | e9d4b23 | 2015-01-26 21:56:45 | [diff] [blame] | 7 | if(POLICY CMP0042) | 
 | 8 |  cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default | 
 | 9 | endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 10 | if(POLICY CMP0022) | 
 | 11 |  cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang | 
 | 12 | endif() | 
 | 13 |  | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 14 | # Add path for custom modules | 
 | 15 | set(CMAKE_MODULE_PATH | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 16 |  "${CMAKE_CURRENT_SOURCE_DIR}/cmake" | 
 | 17 |  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" | 
| Eric Fiselier | ce5695f | 2015-12-30 03:39:03 | [diff] [blame] | 18 |  ${CMAKE_MODULE_PATH} | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 19 |  ) | 
 | 20 |  | 
| Eric Fiselier | 5e000c6 | 2016-11-14 02:43:12 | [diff] [blame] | 21 | if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | 
| Saleem Abdulrasool | 7adfa03 | 2016-02-08 03:50:18 | [diff] [blame] | 22 |  project(libcxx CXX C) | 
 | 23 |  | 
 | 24 |  set(PACKAGE_NAME libcxx) | 
| Shoaib Meenai | 5b0087f | 2017-03-25 03:12:37 | [diff] [blame] | 25 |  set(PACKAGE_VERSION 5.0.0svn) | 
| Saleem Abdulrasool | 7adfa03 | 2016-02-08 03:50:18 | [diff] [blame] | 26 |  set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") | 
 | 27 |  set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") | 
| Eric Fiselier | 5e000c6 | 2016-11-14 02:43:12 | [diff] [blame] | 28 |  | 
 | 29 |  # Find the LLVM sources and simulate LLVM CMake options. | 
 | 30 |  include(HandleOutOfTreeLLVM) | 
| Eugene Zelenko | 96f1017 | 2016-08-08 18:01:50 | [diff] [blame] | 31 | endif() | 
| Saleem Abdulrasool | 7adfa03 | 2016-02-08 03:50:18 | [diff] [blame] | 32 |  | 
| Petr Hosek | 3508e7a | 2017-01-16 00:33:07 | [diff] [blame] | 33 | if (LIBCXX_STANDALONE_BUILD) | 
 | 34 |  include(FindPythonInterp) | 
 | 35 |  if( NOT PYTHONINTERP_FOUND ) | 
 | 36 |  message(WARNING "Failed to find python interpreter. " | 
 | 37 |  "The libc++ test suite will be disabled.") | 
 | 38 |  set(LLVM_INCLUDE_TESTS OFF) | 
 | 39 |  endif() | 
 | 40 | endif() | 
 | 41 |  | 
| Saleem Abdulrasool | 7adfa03 | 2016-02-08 03:50:18 | [diff] [blame] | 42 | # Require out of source build. | 
 | 43 | include(MacroEnsureOutOfSourceBuild) | 
 | 44 | MACRO_ENSURE_OUT_OF_SOURCE_BUILD( | 
 | 45 |  "${PROJECT_NAME} requires an out of source build. Please create a separate | 
 | 46 |  build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there." | 
 | 47 |  ) | 
 | 48 |  | 
| Eric Fiselier | fdd3c91 | 2017-01-14 06:06:47 | [diff] [blame] | 49 | if (MSVC) | 
 | 50 |  set(LIBCXX_TARGETING_MSVC ON) | 
 | 51 | else() | 
 | 52 |  set(LIBCXX_TARGETING_MSVC OFF) | 
 | 53 | endif() | 
 | 54 |  | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 55 | #=============================================================================== | 
 | 56 | # Setup CMake Options | 
 | 57 | #=============================================================================== | 
| Eric Fiselier | 01609af | 2016-09-07 01:15:10 | [diff] [blame] | 58 | include(CMakeDependentOption) | 
| Eric Fiselier | c51e0d2 | 2017-03-11 03:24:18 | [diff] [blame] | 59 | include(HandleCompilerRT) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 60 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 61 | # Basic options --------------------------------------------------------------- | 
| Eric Fiselier | b89eba0 | 2017-02-04 23:22:28 | [diff] [blame] | 62 | option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 63 | option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) | 
| Petr Hosek | b640da0 | 2016-08-08 22:57:25 | [diff] [blame] | 64 | option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) | 
| Eric Fiselier | 5e4698c | 2016-05-03 21:30:18 | [diff] [blame] | 65 | option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) | 
| Eric Fiselier | 5bf8bed | 2017-04-20 04:24:29 | [diff] [blame] | 66 | set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) | 
 | 67 | if (WIN32) | 
 | 68 |  set(ENABLE_FILESYSTEM_DEFAULT OFF) | 
 | 69 | endif() | 
 | 70 | option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++experimental.a" | 
 | 71 |  ${ENABLE_FILESYSTEM_DEFAULT}) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 72 | option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) | 
| Eric Fiselier | 2d2f0c0 | 2016-10-30 22:53:00 | [diff] [blame] | 73 |  | 
| Eric Fiselier | 2d2f0c0 | 2016-10-30 22:53:00 | [diff] [blame] | 74 | # Benchmark options ----------------------------------------------------------- | 
| Eric Fiselier | 0a799bd | 2016-08-29 19:50:49 | [diff] [blame] | 75 | option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependancies" ON) | 
| Eric Fiselier | 2d2f0c0 | 2016-10-30 22:53:00 | [diff] [blame] | 76 | set(LIBCXX_BENCHMARK_NATIVE_STDLIB "" CACHE STRING | 
 | 77 |  "Build the benchmarks against the specified native STL. | 
 | 78 |  The value must be one of libc++/libstdc++") | 
 | 79 | set(LIBCXX_BENCHMARK_NATIVE_GCC_TOOLCHAIN "" CACHE STRING | 
 | 80 |  "Use alternate GCC toolchain when building the native benchmarks") | 
 | 81 |  | 
 | 82 | if (LIBCXX_BENCHMARK_NATIVE_STDLIB) | 
 | 83 |  if (NOT (LIBCXX_BENCHMARK_NATIVE_STDLIB STREQUAL "libc++" | 
 | 84 |  OR LIBCXX_BENCHMARK_NATIVE_STDLIB STREQUAL "libstdc++")) | 
 | 85 |  message(FATAL_ERROR "Invalid value for LIBCXX_BENCHMARK_NATIVE_STDLIB: " | 
 | 86 |  "'${LIBCXX_BENCHMARK_NATIVE_STDLIB}'") | 
 | 87 |  endif() | 
 | 88 | endif() | 
 | 89 |  | 
| Eric Fiselier | b9f425a | 2015-08-22 19:40:49 | [diff] [blame] | 90 | option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS}) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 91 | set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING | 
 | 92 |  "Define suffix of library directory name (32/64)") | 
 | 93 | option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON) | 
| Eric Fiselier | 961269d | 2015-08-26 20:18:21 | [diff] [blame] | 94 | option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 95 | option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON) | 
| Eric Fiselier | 01609af | 2016-09-07 01:15:10 | [diff] [blame] | 96 | cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY | 
 | 97 |  "Install libc++experimental.a" ON | 
 | 98 |  "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) | 
| Evgeniy Stepanov | 4f01aa8 | 2015-10-13 23:48:28 | [diff] [blame] | 99 | set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.") | 
 | 100 | option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF) | 
| Saleem Abdulrasool | e146f75 | 2016-08-24 04:22:52 | [diff] [blame] | 101 | option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 102 |  | 
| Petr Hosek | b640da0 | 2016-08-08 22:57:25 | [diff] [blame] | 103 | if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC) | 
 | 104 |  message(FATAL_ERROR "libc++ must be built as either a shared or static library.") | 
 | 105 | endif() | 
 | 106 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 107 | # ABI Library options --------------------------------------------------------- | 
| Eric Fiselier | cfc5515 | 2017-01-03 01:18:48 | [diff] [blame] | 108 | set(LIBCXX_CXX_ABI "default" CACHE STRING | 
 | 109 |  "Specify C++ ABI library to use.") | 
| Eric Fiselier | bde2871 | 2017-01-16 20:47:35 | [diff] [blame] | 110 | set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++ vcruntime) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 111 | set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS}) | 
 | 112 |  | 
| Eric Fiselier | 1cf5a81 | 2015-10-22 20:54:27 | [diff] [blame] | 113 | # Setup the default options if LIBCXX_CXX_ABI is not specified. | 
| Eric Fiselier | cfc5515 | 2017-01-03 01:18:48 | [diff] [blame] | 114 | if (LIBCXX_CXX_ABI STREQUAL "default") | 
| Petr Hosek | d842fed | 2016-11-09 03:22:28 | [diff] [blame] | 115 |  find_path( | 
 | 116 |  LIBCXX_LIBCXXABI_INCLUDES_INTERNAL | 
 | 117 |  cxxabi.h | 
 | 118 |  PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxxabi/include | 
 | 119 |  ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include | 
 | 120 |  NO_DEFAULT_PATH | 
 | 121 |  ) | 
| Shoaib Meenai | 3d1d1ea | 2017-04-20 23:33:49 | [diff] [blame] | 122 |  if (LIBCXX_TARGETING_MSVC) | 
 | 123 |  # FIXME: Figure out how to configure the ABI library on Windows. | 
 | 124 |  set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") | 
 | 125 |  elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND | 
 | 126 |  IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") | 
| Eric Fiselier | 1cf5a81 | 2015-10-22 20:54:27 | [diff] [blame] | 127 |  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") | 
| Petr Hosek | d842fed | 2016-11-09 03:22:28 | [diff] [blame] | 128 |  set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") | 
| Eric Fiselier | 1cf5a81 | 2015-10-22 20:54:27 | [diff] [blame] | 129 |  set(LIBCXX_CXX_ABI_INTREE 1) | 
| Shoaib Meenai | 3d1d1ea | 2017-04-20 23:33:49 | [diff] [blame] | 130 |  elseif (APPLE) | 
 | 131 |  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") | 
 | 132 |  set(LIBCXX_CXX_ABI_SYSTEM 1) | 
| Eugene Zelenko | 96f1017 | 2016-08-08 18:01:50 | [diff] [blame] | 133 |  else() | 
| Shoaib Meenai | 3d1d1ea | 2017-04-20 23:33:49 | [diff] [blame] | 134 |  set(LIBCXX_CXX_ABI_LIBNAME "default") | 
| Eugene Zelenko | 96f1017 | 2016-08-08 18:01:50 | [diff] [blame] | 135 |  endif() | 
 | 136 | else() | 
| Eric Fiselier | 1cf5a81 | 2015-10-22 20:54:27 | [diff] [blame] | 137 |  set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") | 
| Eugene Zelenko | 96f1017 | 2016-08-08 18:01:50 | [diff] [blame] | 138 | endif() | 
| Eric Fiselier | 1cf5a81 | 2015-10-22 20:54:27 | [diff] [blame] | 139 |  | 
| Eric Fiselier | bb856cc | 2015-10-15 22:41:51 | [diff] [blame] | 140 | # Use a static copy of the ABI library when linking libc++. This option | 
 | 141 | # cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT. | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 142 | option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF) | 
 | 143 |  | 
| Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 | [diff] [blame] | 144 | # Generate and install a linker script inplace of libc++.so. The linker script | 
| Eric Fiselier | bb856cc | 2015-10-15 22:41:51 | [diff] [blame] | 145 | # will link libc++ to the correct ABI library. This option is on by default | 
| Shoaib Meenai | e577401 | 2017-03-25 03:22:35 | [diff] [blame] | 146 | # on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' | 
| Eric Fiselier | 5d5b59b | 2015-10-22 20:50:07 | [diff] [blame] | 147 | # is on. This option is also disabled when the ABI library is not specified | 
 | 148 | # or is specified to be "none". | 
| Eric Fiselier | bb856cc | 2015-10-15 22:41:51 | [diff] [blame] | 149 | set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF) | 
| Eric Fiselier | 1d3716a | 2015-10-15 23:04:54 | [diff] [blame] | 150 | if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY | 
| Eric Fiselier | 1cf5a81 | 2015-10-22 20:54:27 | [diff] [blame] | 151 |  AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none" | 
| Eric Fiselier | cfc5515 | 2017-01-03 01:18:48 | [diff] [blame] | 152 |  AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default" | 
| Asiri Rathnayake | 10a6829 | 2016-05-14 23:58:11 | [diff] [blame] | 153 |  AND PYTHONINTERP_FOUND | 
 | 154 |  AND LIBCXX_ENABLE_SHARED) | 
| Eric Fiselier | bb856cc | 2015-10-15 22:41:51 | [diff] [blame] | 155 |  set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON) | 
 | 156 | endif() | 
 | 157 |  | 
| Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 | [diff] [blame] | 158 | option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT | 
| Eric Fiselier | bb856cc | 2015-10-15 22:41:51 | [diff] [blame] | 159 |  "Use and install a linker script for the given ABI library" | 
| Eric Fiselier | 1d3716a | 2015-10-15 23:04:54 | [diff] [blame] | 160 |  ${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE}) | 
| Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 | [diff] [blame] | 161 |  | 
| Eric Fiselier | dc69aac | 2017-03-02 19:35:33 | [diff] [blame] | 162 | set(ENABLE_NEW_DELETE_DEFAULT ON) | 
 | 163 | if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) | 
| Eric Fiselier | 0cbd39f | 2017-03-02 21:55:03 | [diff] [blame] | 164 | # FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link | 
| Shoaib Meenai | f23e281 | 2017-03-25 03:29:51 | [diff] [blame] | 165 | # programs due to undefined references to new/delete in libc++abi so to work | 
| Eric Fiselier | 0cbd39f | 2017-03-02 21:55:03 | [diff] [blame] | 166 | # around this libc++abi currently defaults LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS | 
 | 167 | # to ON. Once the GCC bug has been worked around this option should be changed | 
 | 168 | # back to OFF. | 
 | 169 |  set(ENABLE_NEW_DELETE_DEFAULT ON) | 
| Eric Fiselier | dc69aac | 2017-03-02 19:35:33 | [diff] [blame] | 170 | endif() | 
 | 171 |  | 
 | 172 | option(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS | 
 | 173 |  "Build libc++ with definitions for operator new/delete. This option can | 
 | 174 |  be used to disable the definitions when libc++abi is expected to provide | 
 | 175 |  them" ${ENABLE_NEW_DELETE_DEFAULT}) | 
 | 176 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 177 | # Build libc++abi with libunwind. We need this option to determine whether to | 
 | 178 | # link with libunwind or libgcc_s while running the test cases. | 
 | 179 | option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF) | 
| Petr Hosek | f4699a5 | 2017-02-09 02:19:43 | [diff] [blame] | 180 | option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 181 |  | 
 | 182 | # Target options -------------------------------------------------------------- | 
 | 183 | option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS}) | 
 | 184 | set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.") | 
 | 185 | set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.") | 
 | 186 |  | 
 | 187 | # Feature options ------------------------------------------------------------- | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 188 | option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON) | 
 | 189 | option(LIBCXX_ENABLE_RTTI "Use run time type information." ON) | 
| Ed Schouten | b33ae5b | 2015-03-12 15:44:39 | [diff] [blame] | 190 | option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON) | 
| Ed Schouten | abd06b4 | 2015-03-26 14:35:46 | [diff] [blame] | 191 | option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON) | 
 | 192 | option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON) | 
| Eric Fiselier | 7330ed3 | 2014-12-06 21:02:58 | [diff] [blame] | 193 | option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON) | 
| Ed Schouten | 323ade3 | 2015-06-24 08:44:38 | [diff] [blame] | 194 | option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON) | 
| Eric Fiselier | 7330ed3 | 2014-12-06 21:02:58 | [diff] [blame] | 195 | option(LIBCXX_ENABLE_MONOTONIC_CLOCK | 
 | 196 |  "Build libc++ with support for a monotonic clock. | 
| Jonathan Roelofs | 5e91fa1 | 2015-08-24 21:20:07 | [diff] [blame] | 197 |  This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON) | 
| Vasileios Kalintiris | 579b42b | 2015-11-09 10:21:04 | [diff] [blame] | 198 | option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF) | 
| Ben Craig | 5163e46 | 2016-05-25 17:40:09 | [diff] [blame] | 199 | option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF) | 
| Asiri Rathnayake | 040945b | 2016-09-11 21:46:40 | [diff] [blame] | 200 | option(LIBCXX_HAS_EXTERNAL_THREAD_API | 
 | 201 |  "Build libc++ with an externalized threading API. | 
 | 202 |  This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF) | 
| Eric Fiselier | 66134e8 | 2017-01-06 20:05:40 | [diff] [blame] | 203 | option(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY | 
 | 204 |  "Build libc++ with an externalized threading library. | 
 | 205 |  This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON" OFF) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 206 |  | 
 | 207 | # Misc options ---------------------------------------------------------------- | 
| Eric Fiselier | cb23a49 | 2015-10-10 03:34:52 | [diff] [blame] | 208 | # FIXME: Turn -pedantic back ON. It is currently off because it warns | 
 | 209 | # about #include_next which is used everywhere. | 
 | 210 | option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 211 | option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) | 
| Saleem Abdulrasool | ab008f7 | 2016-07-12 14:39:13 | [diff] [blame] | 212 | option(LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS "Disable #warnings about conflicting macros." OFF) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 213 |  | 
| Eric Fiselier | bf9653d | 2015-03-31 04:15:45 | [diff] [blame] | 214 | option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF) | 
 | 215 | set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 216 |  "The Profile-rt library used to build with code coverage") | 
 | 217 |  | 
| Eric Fiselier | 961269d | 2015-08-26 20:18:21 | [diff] [blame] | 218 | # Don't allow a user to accidentally overwrite the system libc++ installation on Darwin. | 
 | 219 | # If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++ | 
 | 220 | # will not be generated and a warning will be issued. | 
 | 221 | option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF) | 
 | 222 | mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default. | 
 | 223 |  | 
 | 224 | if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL) | 
 | 225 |  if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") | 
 | 226 |  message(WARNING "Disabling libc++ install rules because installation would " | 
 | 227 |  "overwrite the systems installation. Configure with " | 
 | 228 |  "-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.") | 
 | 229 |  mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option. | 
 | 230 |  set(LIBCXX_INSTALL_HEADERS OFF) | 
 | 231 |  set(LIBCXX_INSTALL_LIBRARY OFF) | 
 | 232 |  endif() | 
 | 233 | endif() | 
 | 234 |  | 
| Eric Fiselier | 85df7a8 | 2015-12-16 23:41:05 | [diff] [blame] | 235 | set(LIBCXX_CONFIGURE_IDE_DEFAULT OFF) | 
 | 236 | if (XCODE OR MSVC_IDE) | 
 | 237 |  set(LIBCXX_CONFIGURE_IDE_DEFAULT ON) | 
 | 238 | endif() | 
 | 239 | option(LIBCXX_CONFIGURE_IDE "Configure libcxx for use within an IDE" | 
 | 240 |  ${LIBCXX_CONFIGURE_IDE_DEFAULT}) | 
 | 241 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 242 | #=============================================================================== | 
 | 243 | # Check option configurations | 
 | 244 | #=============================================================================== | 
 | 245 |  | 
| Eric Fiselier | 6e9a694 | 2016-06-17 19:46:40 | [diff] [blame] | 246 | if (LIBCXX_ENABLE_FILESYSTEM AND NOT LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) | 
 | 247 |  message(FATAL_ERROR | 
 | 248 |  "LIBCXX_ENABLE_FILESYSTEM cannot be turned on when LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF") | 
 | 249 | endif() | 
 | 250 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 251 | # Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when | 
 | 252 | # LIBCXX_ENABLE_THREADS is on. | 
 | 253 | if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK) | 
 | 254 |  message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF" | 
 | 255 |  " when LIBCXX_ENABLE_THREADS is also set to OFF.") | 
| Eric Fiselier | 25a1516 | 2014-08-18 05:03:46 | [diff] [blame] | 256 | endif() | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 257 |  | 
| Asiri Rathnayake | e262e7b | 2017-01-03 12:59:50 | [diff] [blame] | 258 | if(NOT LIBCXX_ENABLE_THREADS) | 
 | 259 |  if(LIBCXX_HAS_PTHREAD_API) | 
 | 260 |  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON" | 
 | 261 |  " when LIBCXX_ENABLE_THREADS is also set to ON.") | 
 | 262 |  endif() | 
 | 263 |  if(LIBCXX_HAS_EXTERNAL_THREAD_API) | 
 | 264 |  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON" | 
 | 265 |  " when LIBCXX_ENABLE_THREADS is also set to ON.") | 
 | 266 |  endif() | 
| Eric Fiselier | 66134e8 | 2017-01-06 20:05:40 | [diff] [blame] | 267 |  if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) | 
 | 268 |  message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set " | 
 | 269 |  "to ON when LIBCXX_ENABLE_THREADS is also set to ON.") | 
 | 270 |  endif() | 
 | 271 |  | 
 | 272 | endif() | 
 | 273 |  | 
| Asiri Rathnayake | da39f1b | 2017-01-09 10:38:56 | [diff] [blame] | 274 | if (LIBCXX_HAS_EXTERNAL_THREAD_API) | 
 | 275 |  if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) | 
 | 276 |  message(FATAL_ERROR "The options LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY and " | 
 | 277 |  "LIBCXX_HAS_EXTERNAL_THREAD_API cannot both be ON at " | 
 | 278 |  "the same time") | 
 | 279 |  endif() | 
 | 280 |  if (LIBCXX_HAS_PTHREAD_API) | 
 | 281 |  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" | 
 | 282 |  "and LIBCXX_HAS_PTHREAD_API cannot be both" | 
 | 283 |  "set to ON at the same time.") | 
 | 284 |  endif() | 
| Asiri Rathnayake | 040945b | 2016-09-11 21:46:40 | [diff] [blame] | 285 | endif() | 
 | 286 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 287 | # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE | 
 | 288 | # is ON. | 
 | 289 | if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE) | 
 | 290 |  message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE") | 
 | 291 | endif() | 
 | 292 |  | 
 | 293 | # Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS) | 
 | 294 | # and check that we can build with 32 bits if requested. | 
 | 295 | if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32) | 
 | 296 |  if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM | 
 | 297 |  message(STATUS "Building 32 bits executables and libraries.") | 
 | 298 |  endif() | 
 | 299 | elseif(LIBCXX_BUILD_32_BITS) | 
 | 300 |  message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.") | 
 | 301 | endif() | 
 | 302 |  | 
 | 303 | # Check that this option is not enabled on Apple and emit a usage warning. | 
| Eric Fiselier | c0b166e | 2015-03-03 15:59:51 | [diff] [blame] | 304 | if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) | 
 | 305 |  if (APPLE) | 
 | 306 |  message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X") | 
 | 307 |  else() | 
 | 308 |  message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option") | 
 | 309 |  endif() | 
| Eric Fiselier | 60479ea | 2016-11-18 19:53:45 | [diff] [blame] | 310 |  if (LIBCXX_ENABLE_STATIC AND NOT PYTHONINTERP_FOUND) | 
 | 311 |  message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY requires python but it was not found.") | 
 | 312 |  endif() | 
| Eric Fiselier | c0b166e | 2015-03-03 15:59:51 | [diff] [blame] | 313 | endif() | 
 | 314 |  | 
| Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 | [diff] [blame] | 315 | if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) | 
 | 316 |  if (APPLE) | 
 | 317 |  message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets") | 
 | 318 |  endif() | 
 | 319 |  if (NOT PYTHONINTERP_FOUND) | 
 | 320 |  message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.") | 
 | 321 |  endif() | 
| Asiri Rathnayake | 10a6829 | 2016-05-14 23:58:11 | [diff] [blame] | 322 |  if (NOT LIBCXX_ENABLE_SHARED) | 
 | 323 |  message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT is only available for shared library builds.") | 
 | 324 |  endif() | 
| Eric Fiselier | 8cbf020 | 2015-10-14 19:54:03 | [diff] [blame] | 325 | endif() | 
 | 326 |  | 
 | 327 | if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) | 
 | 328 |  message(FATAL_ERROR "Conflicting options given. | 
 | 329 |  LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with | 
 | 330 |  LIBCXX_ENABLE_ABI_LINKER_SCRIPT") | 
 | 331 | endif() | 
 | 332 |  | 
| Vasileios Kalintiris | 579b42b | 2015-11-09 10:21:04 | [diff] [blame] | 333 | if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS) | 
 | 334 |  message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off" | 
 | 335 |  "when building for Musl with LIBCXX_HAS_MUSL_LIBC.") | 
 | 336 | endif() | 
 | 337 |  | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 338 | #=============================================================================== | 
 | 339 | # Configure System | 
 | 340 | #=============================================================================== | 
 | 341 |  | 
| Eric Fiselier | 4778eed | 2014-12-20 03:16:55 | [diff] [blame] | 342 | set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) | 
 | 343 | set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | 
 | 344 | set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) | 
| Eric Fiselier | bde2871 | 2017-01-16 20:47:35 | [diff] [blame] | 345 | set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") | 
| Jonas Hahnfeld | f77a7df | 2017-05-04 06:02:50 | [diff] [blame] | 346 | if (LLVM_LIBRARY_OUTPUT_INTDIR) | 
 | 347 |  set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) | 
 | 348 | else() | 
 | 349 |  set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) | 
 | 350 | endif() | 
| Eric Fiselier | bde2871 | 2017-01-16 20:47:35 | [diff] [blame] | 351 | file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") | 
| Eric Fiselier | 4778eed | 2014-12-20 03:16:55 | [diff] [blame] | 352 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 353 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) | 
 | 354 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) | 
| Shoaib Meenai | b975b45 | 2017-04-13 16:27:38 | [diff] [blame] | 355 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 356 |  | 
| Eric Fiselier | 8e2855c | 2014-11-15 06:26:30 | [diff] [blame] | 357 | # Declare libc++ configuration variables. | 
 | 358 | # They are intended for use as follows: | 
 | 359 | # LIBCXX_CXX_FLAGS: General flags for both the compiler and linker. | 
 | 360 | # LIBCXX_COMPILE_FLAGS: Compile only flags. | 
 | 361 | # LIBCXX_LINK_FLAGS: Linker only flags. | 
| Eric Fiselier | 3bf8a9c | 2016-10-09 21:34:03 | [diff] [blame] | 362 | # LIBCXX_LIBRARIES: libraries libc++ is linked to. | 
 | 363 | # LIBCXX_INTERFACE_LIBRARIES: Libraries that must be linked when using libc++ | 
| Eric Fiselier | 742d878 | 2016-10-10 14:45:06 | [diff] [blame] | 364 | # These libraries are exposed in the linker script. | 
| Eric Fiselier | 8e2855c | 2014-11-15 06:26:30 | [diff] [blame] | 365 | set(LIBCXX_COMPILE_FLAGS "") | 
 | 366 | set(LIBCXX_LINK_FLAGS "") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 367 | set(LIBCXX_LIBRARIES "") | 
| Eric Fiselier | 3bf8a9c | 2016-10-09 21:34:03 | [diff] [blame] | 368 | set(LIBCXX_INTERFACE_LIBRARIES "") | 
| Eric Fiselier | 8e2855c | 2014-11-15 06:26:30 | [diff] [blame] | 369 |  | 
| Eric Fiselier | a27cbf8 | 2016-06-02 01:10:08 | [diff] [blame] | 370 | # Include macros for adding and removing libc++ flags. | 
 | 371 | include(HandleLibcxxFlags) | 
 | 372 |  | 
 | 373 | # Target flags ================================================================ | 
 | 374 | # These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that | 
 | 375 | # 'config-ix' use them during feature checks. It also adds them to both | 
 | 376 | # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS' | 
 | 377 | add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32") | 
| Petr Hosek | cebb3e9 | 2017-04-16 02:25:55 | [diff] [blame] | 378 | add_target_flags_if(LIBCXX_TARGET_TRIPLE "--target=${LIBCXX_TARGET_TRIPLE}") | 
| Eric Fiselier | a27cbf8 | 2016-06-02 01:10:08 | [diff] [blame] | 379 | add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}") | 
| Petr Hosek | cebb3e9 | 2017-04-16 02:25:55 | [diff] [blame] | 380 | add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") | 
| Eric Fiselier | 6e467a8 | 2016-11-13 22:27:00 | [diff] [blame] | 381 | if (LIBCXX_TARGET_TRIPLE) | 
 | 382 |  set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}") | 
 | 383 | endif() | 
| Eric Fiselier | a27cbf8 | 2016-06-02 01:10:08 | [diff] [blame] | 384 |  | 
| Eric Fiselier | 9a1468f | 2014-11-15 17:25:23 | [diff] [blame] | 385 | # Configure compiler. | 
 | 386 | include(config-ix) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 387 |  | 
| Saleem Abdulrasool | e146f75 | 2016-08-24 04:22:52 | [diff] [blame] | 388 | if (LIBCXX_USE_COMPILER_RT) | 
 | 389 |  list(APPEND LIBCXX_LINK_FLAGS "-rtlib=compiler-rt") | 
 | 390 | endif() | 
 | 391 |  | 
| Eric Fiselier | bf9653d | 2015-03-31 04:15:45 | [diff] [blame] | 392 | # Configure coverage options. | 
 | 393 | if (LIBCXX_GENERATE_COVERAGE) | 
 | 394 |  include(CodeCoverage) | 
 | 395 |  set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE) | 
 | 396 | endif() | 
| Eric Fiselier | 9a1468f | 2014-11-15 17:25:23 | [diff] [blame] | 397 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 398 | string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) | 
| Eric Fiselier | 157fd34 | 2017-01-14 07:54:39 | [diff] [blame] | 399 | if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") | 
 | 400 |  set(LIBCXX_DEBUG_BUILD ON) | 
 | 401 | else() | 
 | 402 |  set(LIBCXX_DEBUG_BUILD OFF) | 
 | 403 | endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 404 |  | 
| Eric Fiselier | 9a1468f | 2014-11-15 17:25:23 | [diff] [blame] | 405 | #=============================================================================== | 
 | 406 | # Setup Compiler Flags | 
 | 407 | #=============================================================================== | 
 | 408 |  | 
| JF Bastien | c7c4c77 | 2016-03-05 14:22:02 | [diff] [blame] | 409 | include(HandleLibCXXABI) # Setup the ABI library flags | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 410 |  | 
| Michal Gorny | b79ca0a | 2016-09-27 07:55:26 | [diff] [blame] | 411 | if (NOT LIBCXX_STANDALONE_BUILD) | 
 | 412 |  # Remove flags that may have snuck in. | 
 | 413 |  remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG | 
| Eric Fiselier | 8e39559 | 2017-01-17 23:27:56 | [diff] [blame] | 414 |  -lc++abi) | 
| Michal Gorny | b79ca0a | 2016-09-27 07:55:26 | [diff] [blame] | 415 | endif() | 
 | 416 | remove_flags(-stdlib=libc++ -stdlib=libstdc++) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 417 |  | 
| Eric Fiselier | fdd3c91 | 2017-01-14 06:06:47 | [diff] [blame] | 418 | # FIXME: Remove all debug flags and flags that change which Windows | 
 | 419 | # default libraries are linked. Currently we only support linking the | 
 | 420 | # non-debug DLLs | 
| Eric Fiselier | 157fd34 | 2017-01-14 07:54:39 | [diff] [blame] | 421 | remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md") | 
| Eric Fiselier | fdd3c91 | 2017-01-14 06:06:47 | [diff] [blame] | 422 |  | 
| Shoaib Meenai | 68fdad6 | 2017-03-25 03:42:20 | [diff] [blame] | 423 | # FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC. | 
| Eric Fiselier | 7b081f6 | 2015-10-15 20:27:15 | [diff] [blame] | 424 | # Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors | 
| Shoaib Meenai | 68fdad6 | 2017-03-25 03:42:20 | [diff] [blame] | 425 | # so they don't get transformed into -Wno and -errors respectively. | 
| Eric Fiselier | 7b081f6 | 2015-10-15 20:27:15 | [diff] [blame] | 426 | remove_flags(-Wno-pedantic -pedantic-errors -pedantic) | 
| Eric Fiselier | 499d878 | 2015-10-13 23:56:33 | [diff] [blame] | 427 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 428 | # Required flags ============================================================== | 
| Eric Fiselier | c9e74dd | 2016-08-14 22:51:54 | [diff] [blame] | 429 | set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") | 
| Petr Hosek | 44197a1 | 2016-10-23 21:48:27 | [diff] [blame] | 430 | if (LIBCXX_HAS_MUSL_LIBC) | 
 | 431 |  # musl's pthread implementations uses volatile types in their structs which is | 
 | 432 |  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl. | 
 | 433 |  set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change build dialect") | 
 | 434 | endif() | 
| Eric Fiselier | c9e74dd | 2016-08-14 22:51:54 | [diff] [blame] | 435 | add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) | 
 | 436 | mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) | 
| Saleem Abdulrasool | 1ca3c45 | 2017-01-01 20:20:40 | [diff] [blame] | 437 | if(NOT ${SUPPORTS_DIALECT_NAME}) | 
 | 438 |  if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") | 
 | 439 |  message(FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER}") | 
 | 440 |  endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 441 | endif() | 
 | 442 |  | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 443 | # On all systems the system c++ standard library headers need to be excluded. | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 444 | # MSVC only has -X, which disables all default includes; including the crt. | 
 | 445 | # Thus, we do nothing and hope we don't accidentally include any of the C++ | 
 | 446 | # headers | 
 | 447 | add_compile_flags_if_supported(-nostdinc++) | 
| Eric Fiselier | d74dee9 | 2015-07-29 21:07:28 | [diff] [blame] | 448 |  | 
| Eric Fiselier | 8330b1e | 2016-10-25 19:43:44 | [diff] [blame] | 449 | # Hide all inline function definitions which have not explicitly been marked | 
 | 450 | # visible. This prevents new definitions for inline functions from appearing in | 
 | 451 | # the dylib when get ODR used by another function. | 
 | 452 | add_compile_flags_if_supported(-fvisibility-inlines-hidden) | 
 | 453 |  | 
| Eric Fiselier | 74c9857 | 2016-09-26 22:19:41 | [diff] [blame] | 454 | # Let the library headers know they are currently being used to build the | 
 | 455 | # library. | 
| Eric Fiselier | 6dbed46 | 2016-09-16 00:00:48 | [diff] [blame] | 456 | add_definitions(-D_LIBCPP_BUILDING_LIBRARY) | 
 | 457 |  | 
| Eric Fiselier | dc69aac | 2017-03-02 19:35:33 | [diff] [blame] | 458 | if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS) | 
 | 459 |  add_definitions(-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS) | 
 | 460 | endif() | 
 | 461 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 462 | # Warning flags =============================================================== | 
| Eric Fiselier | 692177d | 2015-07-18 20:40:46 | [diff] [blame] | 463 | add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 464 | add_compile_flags_if_supported( | 
| Eric Fiselier | 3ec6b84 | 2016-08-29 20:43:38 | [diff] [blame] | 465 |  -Wall -Wextra -W -Wwrite-strings | 
 | 466 |  -Wno-unused-parameter -Wno-long-long | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 467 |  -Werror=return-type) | 
| Eric Fiselier | 3ec6b84 | 2016-08-29 20:43:38 | [diff] [blame] | 468 | if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | 
 | 469 |  add_compile_flags_if_supported( | 
 | 470 |  -Wno-user-defined-literals | 
 | 471 |  -Wno-covered-switch-default) | 
 | 472 | elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") | 
 | 473 |  add_compile_flags_if_supported( | 
| Eric Fiselier | 3ec6b84 | 2016-08-29 20:43:38 | [diff] [blame] | 474 |  -Wno-literal-suffix | 
| Eric Fiselier | f3b3a65 | 2017-04-03 20:53:15 | [diff] [blame] | 475 |  -Wno-c++14-compat | 
 | 476 |  -Wno-noexcept-type) | 
| Eric Fiselier | 3ec6b84 | 2016-08-29 20:43:38 | [diff] [blame] | 477 | endif() | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 478 | if (LIBCXX_ENABLE_WERROR) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 479 |  add_compile_flags_if_supported(-Werror) | 
 | 480 |  add_compile_flags_if_supported(-WX) | 
| Eric Fiselier | 26d2390 | 2015-07-31 01:25:01 | [diff] [blame] | 481 | else() | 
 | 482 |  # TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is | 
 | 483 |  # added elsewhere. | 
 | 484 |  add_compile_flags_if_supported(-Wno-error) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 485 | endif() | 
 | 486 | if (LIBCXX_ENABLE_PEDANTIC) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 487 |  add_compile_flags_if_supported(-pedantic) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 488 | endif() | 
| Saleem Abdulrasool | ab008f7 | 2016-07-12 14:39:13 | [diff] [blame] | 489 | if (LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS) | 
 | 490 |  add_definitions(-D_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) | 
 | 491 | endif() | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 492 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 493 | # Exception flags ============================================================= | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 494 | if (LIBCXX_ENABLE_EXCEPTIONS) | 
 | 495 |  # Catches C++ exceptions only and tells the compiler to assume that extern C | 
 | 496 |  # functions never throw a C++ exception. | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 497 |  add_compile_flags_if_supported(-EHsc) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 498 | else() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 499 |  add_definitions(-D_LIBCPP_NO_EXCEPTIONS) | 
 | 500 |  add_compile_flags_if_supported(-EHs- -EHa-) | 
 | 501 |  add_compile_flags_if_supported(-fno-exceptions) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 502 | endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 503 |  | 
 | 504 | # RTTI flags ================================================================== | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 505 | if (NOT LIBCXX_ENABLE_RTTI) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 506 |  add_definitions(-D_LIBCPP_NO_RTTI) | 
 | 507 |  add_compile_flags_if_supported(-GR-) | 
 | 508 |  add_compile_flags_if_supported(-fno-rtti) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 509 | endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 510 |  | 
| Asiri Rathnayake | 040945b | 2016-09-11 21:46:40 | [diff] [blame] | 511 | # Threading flags ============================================================= | 
| Asiri Rathnayake | da39f1b | 2017-01-09 10:38:56 | [diff] [blame] | 512 | if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_ENABLE_SHARED) | 
| Asiri Rathnayake | 040945b | 2016-09-11 21:46:40 | [diff] [blame] | 513 |  # Need to allow unresolved symbols if this is to work with shared library builds | 
 | 514 |  if (APPLE) | 
 | 515 |  add_link_flags("-undefined dynamic_lookup") | 
 | 516 |  else() | 
 | 517 |  # Relax this restriction from HandleLLVMOptions | 
 | 518 |  string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") | 
 | 519 |  endif() | 
 | 520 | endif() | 
 | 521 |  | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 522 | # Assertion flags ============================================================= | 
 | 523 | define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG) | 
 | 524 | define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG) | 
| Eric Fiselier | b89eba0 | 2017-02-04 23:22:28 | [diff] [blame] | 525 | define_if(LIBCXX_ENABLE_ASSERTIONS -D_LIBCPP_DEBUG=0) | 
| Eric Fiselier | 157fd34 | 2017-01-14 07:54:39 | [diff] [blame] | 526 | define_if(LIBCXX_DEBUG_BUILD -D_DEBUG) | 
 | 527 | if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 528 |  # MSVC doesn't like _DEBUG on release builds. See PR 4379. | 
| Eric Fiselier | fdd3c91 | 2017-01-14 06:06:47 | [diff] [blame] | 529 |  define_if_not(LIBCXX_TARGETING_MSVC -D_DEBUG) | 
| Howard Hinnant | 4a0e74f | 2013-02-25 15:50:36 | [diff] [blame] | 530 | endif() | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 531 |  | 
| Eric Fiselier | 29026ad | 2016-10-14 12:56:52 | [diff] [blame] | 532 | # Modules flags =============================================================== | 
 | 533 | # FIXME The libc++ sources are fundamentally non-modular. They need special | 
 | 534 | # versions of the headers in order to provide C++03 and legacy ABI definitions. | 
 | 535 | # NOTE: The public headers can be used with modules in all other contexts. | 
 | 536 | if (LLVM_ENABLE_MODULES) | 
 | 537 |  # Ignore that the rest of the modules flags are now unused. | 
 | 538 |  add_compile_flags_if_supported(-Wno-unused-command-line-argument) | 
 | 539 |  add_compile_flags(-fno-modules) | 
 | 540 | endif() | 
 | 541 |  | 
| Jonathan Roelofs | 5e91fa1 | 2015-08-24 21:20:07 | [diff] [blame] | 542 | # Sanitizer flags ============================================================= | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 543 |  | 
| Chris Bieneman | 8c22696 | 2016-08-18 21:31:51 | [diff] [blame] | 544 | # Configure for sanitizers. If LIBCXX_STANDALONE_BUILD then we have to do | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 545 | # the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it. | 
| Chris Bieneman | 8c22696 | 2016-08-18 21:31:51 | [diff] [blame] | 546 | if (LIBCXX_STANDALONE_BUILD) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 547 |  set(LLVM_USE_SANITIZER "" CACHE STRING | 
 | 548 |  "Define the sanitizer used to build the library and tests") | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 549 |  # NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC. | 
 | 550 |  # But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do. | 
 | 551 |  if (LLVM_USE_SANITIZER AND NOT MSVC) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 552 |  add_flags_if_supported("-fno-omit-frame-pointer") | 
 | 553 |  add_flags_if_supported("-gline-tables-only") | 
 | 554 |  | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 555 |  if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND | 
 | 556 |  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 557 |  add_flags_if_supported("-gline-tables-only") | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 558 |  endif() | 
 | 559 |  if (LLVM_USE_SANITIZER STREQUAL "Address") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 560 |  add_flags("-fsanitize=address") | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 561 |  elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 562 |  add_flags(-fsanitize=memory) | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 563 |  if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 564 |  add_flags("-fsanitize-memory-track-origins") | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 565 |  endif() | 
 | 566 |  elseif (LLVM_USE_SANITIZER STREQUAL "Undefined") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 567 |  add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all") | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 568 |  elseif (LLVM_USE_SANITIZER STREQUAL "Thread") | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 569 |  add_flags(-fsanitize=thread) | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 570 |  else() | 
 | 571 |  message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}") | 
 | 572 |  endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 573 |  elseif(LLVM_USE_SANITIZER AND MSVC) | 
 | 574 |  message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.") | 
| Eric Fiselier | 5514d36 | 2015-07-29 23:46:55 | [diff] [blame] | 575 |  endif() | 
 | 576 | endif() | 
| Eric Fiselier | 73ffc78 | 2015-10-13 22:12:02 | [diff] [blame] | 577 |  | 
 | 578 | # Configuration file flags ===================================================== | 
| Evgeniy Stepanov | 4f01aa8 | 2015-10-13 23:48:28 | [diff] [blame] | 579 | if (NOT LIBCXX_ABI_VERSION EQUAL "1") | 
 | 580 |  config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION) | 
 | 581 | endif() | 
 | 582 | config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE) | 
 | 583 |  | 
| Eric Fiselier | 73ffc78 | 2015-10-13 22:12:02 | [diff] [blame] | 584 | config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE) | 
 | 585 | config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN) | 
 | 586 | config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT) | 
 | 587 | config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS) | 
 | 588 | config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK) | 
 | 589 | config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS) | 
 | 590 |  | 
| Ben Craig | 5163e46 | 2016-05-25 17:40:09 | [diff] [blame] | 591 | config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD) | 
| Asiri Rathnayake | 040945b | 2016-09-11 21:46:40 | [diff] [blame] | 592 | config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL) | 
| Eric Fiselier | 66134e8 | 2017-01-06 20:05:40 | [diff] [blame] | 593 | config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) | 
| Vasileios Kalintiris | 579b42b | 2015-11-09 10:21:04 | [diff] [blame] | 594 | config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) | 
 | 595 |  | 
| Eric Fiselier | 74c9857 | 2016-09-26 22:19:41 | [diff] [blame] | 596 | # By default libc++ on Windows expects to use a shared library, which requires | 
 | 597 | # the headers to use DLL import/export semantics. However when building a | 
 | 598 | # static library only we modify the headers to disable DLL import/export. | 
 | 599 | if (DEFINED WIN32 AND LIBCXX_ENABLE_STATIC AND NOT LIBCXX_ENABLE_SHARED) | 
 | 600 |  message(STATUS "Generating custom __config for non-DLL Windows build") | 
| Shoaib Meenai | c6d8e8a | 2016-12-05 19:40:12 | [diff] [blame] | 601 |  config_define(ON _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) | 
| Eric Fiselier | 74c9857 | 2016-09-26 22:19:41 | [diff] [blame] | 602 | endif() | 
 | 603 |  | 
| Eric Fiselier | 73ffc78 | 2015-10-13 22:12:02 | [diff] [blame] | 604 | if (LIBCXX_NEEDS_SITE_CONFIG) | 
| Saleem Abdulrasool | 1ca3c45 | 2017-01-01 20:20:40 | [diff] [blame] | 605 |  configure_file("include/__config_site.in" | 
 | 606 |  "${LIBCXX_BINARY_DIR}/__config_site" | 
 | 607 |  @ONLY) | 
 | 608 |  | 
| Eric Fiselier | a662279 | 2015-10-14 00:22:05 | [diff] [blame] | 609 |  # Provide the config definitions by included the generated __config_site | 
 | 610 |  # file at compile time. | 
| Saleem Abdulrasool | 1ca3c45 | 2017-01-01 20:20:40 | [diff] [blame] | 611 |  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") | 
 | 612 |  add_compile_flags("/FI\"${LIBCXX_BINARY_DIR}/__config_site\"") | 
 | 613 |  else() | 
 | 614 |  add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site") | 
 | 615 |  endif() | 
| Eric Fiselier | 73ffc78 | 2015-10-13 22:12:02 | [diff] [blame] | 616 | endif() | 
 | 617 |  | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 618 | #=============================================================================== | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 619 | # Setup Source Code And Tests | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 620 | #=============================================================================== | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 621 | include_directories(include) | 
| Howard Hinnant | c4962b3 | 2013-11-15 17:18:57 | [diff] [blame] | 622 | add_subdirectory(include) | 
| Michael J. Spencer | 626916f | 2010-12-10 19:47:54 | [diff] [blame] | 623 | add_subdirectory(lib) | 
| Eric Fiselier | b9f425a | 2015-08-22 19:40:49 | [diff] [blame] | 624 |  | 
| Eric Fiselier | 5e000c6 | 2016-11-14 02:43:12 | [diff] [blame] | 625 |  | 
| Eric Fiselier | d9b9ef7 | 2016-07-19 23:07:03 | [diff] [blame] | 626 | if (LIBCXX_INCLUDE_BENCHMARKS) | 
 | 627 |  add_subdirectory(benchmarks) | 
 | 628 | endif() | 
| Eric Fiselier | c57fb58 | 2017-03-01 21:53:30 | [diff] [blame] | 629 |  | 
 | 630 | # Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or | 
 | 631 | # LLVM_FOUND is OFF. This allows users to run the tests manually using | 
 | 632 | # LIT without requiring a full LLVM checkout. | 
| Duncan P. N. Exon Smith | 59a094f | 2017-05-03 23:33:54 | [diff] [blame] | 633 | # | 
 | 634 | # However, since some submission systems strip test/ subdirectories, check for | 
 | 635 | # it before adding it. | 
 | 636 | if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") | 
 | 637 |  add_subdirectory(test) | 
 | 638 | endif() | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 639 | if (LIBCXX_INCLUDE_TESTS) | 
| Eric Fiselier | 5e000c6 | 2016-11-14 02:43:12 | [diff] [blame] | 640 |  add_subdirectory(lib/abi) | 
| Eric Fiselier | eb6e2ea | 2015-07-30 22:30:34 | [diff] [blame] | 641 | endif() | 
| Eric Fiselier | c57fb58 | 2017-03-01 21:53:30 | [diff] [blame] | 642 |  | 
| Eric Fiselier | b9f425a | 2015-08-22 19:40:49 | [diff] [blame] | 643 | if (LIBCXX_INCLUDE_DOCS) | 
 | 644 |  add_subdirectory(docs) | 
 | 645 | endif() |